<?php
require_once dirname(__FILE__) . "/../includes/config.php";
require_once PHP_ROOTPATH.'/classes/database.php';

//récupération des noms de boite en fonction du tissu sélectionné
header("Content-Type: text/xml; charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<list>";
 
$tissu = (isset($_POST["tissu"])) ? html_entity_decode($_POST["tissu"]) : NULL;

if ($tissu ) {
    $id_connect=Database::getInstance();
    $query_temp = "SELECT DISTINCT(nom_boite) FROM Biobanque WHERE type_tissu='".pg_escape_string($tissu) ."' ORDER BY nom_boite";
    $res_query = pg_query($id_connect , $query_temp) or die(pg_last_error());
    while ($back = pg_fetch_assoc($res_query)) {
        echo "<item id=\"" . $back["nom_boite"] . "\" name=\"" . $back["nom_boite"] . "\" />\n";
    }
}
 
echo "</list>";


?>
